package com.iwdnb.gkgz.common.model.dto;

import java.util.List;

import lombok.Data;

/**
 * @author pengl
 * @date 2020/05/02
 **/
@Data
public class StockAnalasysData {
    /**
     * 股票代码
     */
    private String code;
    /**
     * 交易天数
     */
    private int days;
    /**
     * 振幅次数(金额分)
     */
    private ScoreData amplitudeCount;

    /**
     * 收盘价上涨次数(金额分)
     */
    private ScoreData upData;

    /**
     * 收盘价下跌次数(金额分)
     */
    private ScoreData downData;
    /**
     * 收盘价上涨次数总计
     */
    private int upCount;

    /**
     * 收盘价下跌次数总计
     */
    private int downCount;
    /**
     * 开盘价为最高价次数总计
     */
    private int maxOpenCount;
    /**
     * 开盘价为最低价次数总计
     */
    private int minOpenCount;
    /**
     * 收盘价为最高价次数总计
     */
    private int maxCloseCount;
    /**
     * 收盘价为最低价次数总计
     */
    private int minCloseCount;

    /**
     * 开盘价向上偏离昨天股价振幅的次数(跳空高开)
     */
    private int openUpDeviateYesterdayCount;
    /**
     * 跳空高开交易日
     */
    private List<String> openUpDeviateDate;
    /**
     * 开盘价向下偏离昨天股价振幅的次数(跳空低开)
     */
    private int openDownDeviateYesterdayCount;
    /**
     * 跳空低开交易日
     */
    private List<String> openDownDeviateDate;
    /**
     * 振幅偏离昨天股价振幅的次数
     */
    private int rangeDeviateYesterdayCount;
    /**
     * 振幅偏离昨天股价交易日
     */
    private List<String> rangeDeviateDate;

    @Data
    public static class ScoreData {
        private int zero;
        private int one;
        private int two;
        private int three;
        private int four;
        private int five;
        private int six;
        private int seven;
        private int eight;
        private int nine;
        private int ten;
        private int eleven;
        /**
         * 小于5分的次数
         */
        private int leFiveCount;

        public void addScoreCount(int score) {
            switch (score) {
                case 0:
                    zero++;
                    break;
                case 1:
                    one++;
                    break;
                case 2:
                    two++;
                    break;
                case 3:
                    three++;
                    break;
                case 4:
                    four++;
                    break;
                case 5:
                    five++;
                    break;
                case 6:
                    six++;
                    break;
                case 7:
                    seven++;
                    break;
                case 8:
                    eight++;
                    break;
                case 9:
                    nine++;
                    break;
                case 10:
                    ten++;
                    break;
                case 11:
                    eleven++;
                    break;
                default:
                    System.out.println("addScoreCount 特殊数据:" + score);
            }

        }

        public void caculate() {
            leFiveCount = zero + one + two + three + four;
        }
    }

}
